//**************************************************************************************
// Product Generated Class File
//**************************************************************************************
//**** DO NOT CHANGE THIS FILE.  THE CONTENTS WILL BE OVERRIDEN ON NEXT MODEL SAVE. ****
//**************************************************************************************
using System;
using System.ComponentModel;
using DevExpress.ExpressApp;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;
using DevExpress.Xpo;

namespace Demo.Module
{
	[ImageName("BO_Unknown")]
	[CreatableItem(true)]
	[NavigationItem(true)]
	[DefaultListViewOptions()]
	public partial class Product : XPLiteObject
	{
		public Product() : base()
		{
		}

		public Product(Session session) : base(session)
		{
		}

		private Int32 m_id;
		[Key(true)]
		public Int32 Id
		{
			get { return m_id; }
			set { SetPropertyValue("Id", ref m_id, value); }
		}

		private String m_name;
		[Size(50)]
		[RuleRequiredField("Product_Name_RuleRequiredField", DefaultContexts.Save, "Product name is required.")]
		[RuleUniqueValue("Product_Name_RuleUniqueValue", DefaultContexts.Save, "Product name nust be unique.")]
		public String Name
		{
			get { return m_name; }
			set { SetPropertyValue("Name", ref m_name, value); }
		}

		[Association("BusinessModel.ProductOrderDetail")]
		[Aggregated]
		public XPCollection<OrderDetail> OrderDetails
		{
		    get
		    {
    		    return GetCollection<OrderDetail>("OrderDetails");
		    }
		}

	}
}
